<form name="service.$forms.env" novalidate>
    <div class="row">
        <div class="col-md-8">
            <table class="table table-inline-edit margin-bottom-0">
                <thead>
                <tr>
                    <th width="45%">Key</th>
                    <th width="45%">Value</th>
                    <th width="10%"></th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="elem in service.envs" ng-hide="elem.hide">
                    <td ng-class="{'has-error': (service.$forms.env['key'+$index].$touched || service.$forms.env.$submitted )
                                && (service.$forms.env['key'+$index].$error.required || service.$forms.env['key'+$index].$error.pattern || service.$forms.env['key'+$index].$error.duplicate)}">
                        <input ng-model="elem.key" name="key{{$index}}" type="text"
                               ng-pattern="/^[A-Za-z\d-.]+$/"
                               uib-tooltip="{{((service.$forms.env['key'+$index].$error.required || service.$forms.env['key'+$index].$error.pattern)  && '请输入有效值')
                                       || (service.$forms.env['key'+$index].$error.duplicate && '该值已存在')}}" tooltip-trigger="none" tooltip-class="has-error"
                               tooltip-is-open="(service.$forms.env['key'+$index].$touched || service.$forms.env.$submitted ) && service.$forms.env['key'+$index].$focus
                                           && (service.$forms.env['key'+$index].$error.required || service.$forms.env['key'+$index].$error.pattern
                                           || service.$forms.env['key'+$index].$error.duplicate)"
                               tooltip-placement="left" ng-focus="service.$forms.env['key'+$index].$focus=true"
                               ng-blur="service.$forms.env['key'+$index].$focus=false;env.checkEnvKey($index, service.envs, service.$forms.env)" required/>
                    </td>
                    <td ng-class="{'has-error': (service.$forms.env['value'+$index].$touched || service.$forms.env.$submitted )
                                && service.$forms.env['value'+$index].$error.required}">
                        <input ng-model="elem.value" name="value{{$index}}" type="text"
                               uib-tooltip="请输入有效值" tooltip-trigger="none" tooltip-class="has-error"
                               tooltip-is-open="(service.$forms.env['value'+$index].$touched || service.$forms.env.$submitted ) && service.$forms.env['value'+$index].$focus
                                           && service.$forms.env['value'+$index].$error.required"
                               tooltip-placement="left" ng-focus="service.$forms.env['value'+$index].$focus=true"
                               ng-blur="service.$forms.env['value'+$index].$focus=false" required/>
                    </td>
                    <td class="text-center"><a ng-click="env.envRemove($index, service.envs)" title="删除"><i class="fa fa-trash fa-lg"/></a></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <a ng-click="env.envAdd(service.envs)">+ 添加变量</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="col-md-4">
            <div class="form-tooltip-group"><i class="fa fa-question"></i>Key: 允许数字、英文字母与横线</div>
        </div>
    </div>
</form>